import request from '@/utils/request'
import qs from "qs"

// let requestUrl = "/api-order/order/";
export default {

    // 分页查询订单列表并排序
    pageOrder(pageNum,pageSize,sort) {
        return request({
            url: '/api-order/order/pageOrder',
            method: 'get',
            params: {
                pageNum,
                pageSize,
                sort
            }
        })
    },
    // 分页查询已经发货的订单列表并排序
    pageOrderTwo(pageNum, pageSize, sort) {
        return request({
            url: '/api-order/order/pageOrderTwo',
            method: 'get',
            params: {
                pageNum,
                pageSize,
                sort
            }
        })
    },

    // 分页查询订单列表并筛选还排序
    pageSelect(pageNum,
        pageSize, sort,
         orderStatus, transactionId,
       receiverMobile, createTime,sourceType){

          return request({
            url: '/api-order/order/pageSelect',
            method: 'get',
            params: {
             pageNum,
        pageSize, sort,
         orderStatus, transactionId,
       receiverMobile, createTime,sourceType
            }
        })
       },

    //    分页查询订单列表并筛选还排序(查询的是已经发货的列表)
       pageSelectTwo(pageNum,
        pageSize, sort,
      transactionId,
       receiverMobile, createTime,sourceType){

            return request({
                url: '/api-order/order/pageSelectTwo',
                method: 'get',
                params: {
                 pageNum,
            pageSize, sort,
             transactionId,
           receiverMobile, createTime,sourceType
                }
            })
        },
    // 批量关闭订单
    updateListClose(ids){
        var data = qs.stringify({ids});
        return request({
            url: '/api-order/order/updateListClose',
            method: 'put',
            data
        })

    },
    // 批量修改订单为已完成
    updateListSuccess(ids) {
        var data = qs.stringify({ ids });
        return request({
            url: '/api-order/order/updateListSuccess',
            method: 'put',
            data
        })

    },

    // 批量删除订单软三
    deleteList(ids){
        var data = qs.stringify({ids});
        return request({
            url: '/api-order/order/deleteListClose',
            method: 'delete',
            data
        })  
    },

    // 单个关闭或删除订单软三或修改数据
updateOne(order){
    var data = qs.stringify(order);
    return request({
        url: '/api-order/order/updateOne',
        method: 'put',
        data
    })  

},

// 查询未发货的订单列表
selectByStatus(){
    return request({
        url: '/api-order/order/selectByStatus',
        method: 'get',
        
    })  
    
},

// 批量修改
    updateAll(orderList){

        var data = qs.stringify(orderList);
        console.log(data);
        return request({
            url: '/api-order/order/updateAll',
            method: 'put',
            // headers: {'Content-Type':'application/json'},
            data
        })     
    },

    // 查询记录

    getAllObjs(orderStatus){

        return request({
            url: '/api-order/order/getAllObjs',
            method: 'get',
            params: {
               orderStatus
            }
        })  
    },

    // 根据id查询
    selectById(id){

        return request({
            url: '/api-order/order/selectById',
            method: 'get',
            params: {
             id
            }
        })
    }

}